/*
* Copyright 2025 NXP
* NXP Proprietary. This software is owned or controlled by NXP and may only be used strictly in
* accordance with the applicable license terms. By expressly accepting such terms or by downloading, installing,
* activating and/or otherwise using the software, you are agreeing that you have read, and that you agree to
* comply with and are bound by, such license terms.  If you do not agree to be bound by the applicable license
* terms, then you may not retain, install, activate or otherwise use the software.
*/

#include "lvgl.h"
#include <stdio.h>
#include "gui_guider.h"
#include "events_init.h"
#include "widgets_init.h"
#include "custom.h"

void setup_scr_screen_wifi(lv_ui *ui)
{
    static bool inited = false;     // 静态变量，程序生命周期内只创建一次
    if (inited) return;             // 已经初始化过，直接返回
    inited = true;                  // 标记为已初始化
    
    //Write codes screen_wifi
    ui->screen_wifi = lv_obj_create(NULL);
    lv_obj_set_size(ui->screen_wifi, 240, 280);
    lv_obj_set_scrollbar_mode(ui->screen_wifi, LV_SCROLLBAR_MODE_OFF);

    //Write style for screen_wifi, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_bg_opa(ui->screen_wifi, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(ui->screen_wifi, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_dir(ui->screen_wifi, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes screen_wifi_BACK_Button
    ui->screen_wifi_BACK_Button = lv_btn_create(ui->screen_wifi);
    ui->screen_wifi_BACK_Button_label = lv_label_create(ui->screen_wifi_BACK_Button);
    lv_label_set_text(ui->screen_wifi_BACK_Button_label, "" LV_SYMBOL_CLOSE "");
    lv_label_set_long_mode(ui->screen_wifi_BACK_Button_label, LV_LABEL_LONG_WRAP);
    lv_obj_align(ui->screen_wifi_BACK_Button_label, LV_ALIGN_CENTER, 0, 0);
    lv_obj_set_style_pad_all(ui->screen_wifi_BACK_Button, 0, LV_STATE_DEFAULT);
    lv_obj_set_width(ui->screen_wifi_BACK_Button_label, LV_PCT(100));
    lv_obj_set_pos(ui->screen_wifi_BACK_Button, 20, 10);
    lv_obj_set_size(ui->screen_wifi_BACK_Button, 200, 32);

    //Write style for screen_wifi_BACK_Button, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_bg_opa(ui->screen_wifi_BACK_Button, 228, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(ui->screen_wifi_BACK_Button, lv_color_hex(0x767676), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_dir(ui->screen_wifi_BACK_Button, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_width(ui->screen_wifi_BACK_Button, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_radius(ui->screen_wifi_BACK_Button, 25, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_width(ui->screen_wifi_BACK_Button, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(ui->screen_wifi_BACK_Button, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(ui->screen_wifi_BACK_Button, &lv_font_Acme_Regular_25, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_opa(ui->screen_wifi_BACK_Button, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_align(ui->screen_wifi_BACK_Button, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes screen_wifi_SmartConfig_Button
    ui->screen_wifi_SmartConfig_Button = lv_btn_create(ui->screen_wifi);
    ui->screen_wifi_SmartConfig_Button_label = lv_label_create(ui->screen_wifi_SmartConfig_Button);
    lv_label_set_text(ui->screen_wifi_SmartConfig_Button_label, "SmartConfig Connection");
    lv_label_set_long_mode(ui->screen_wifi_SmartConfig_Button_label, LV_LABEL_LONG_WRAP);
    lv_obj_align(ui->screen_wifi_SmartConfig_Button_label, LV_ALIGN_CENTER, 0, 0);
    lv_obj_set_style_pad_all(ui->screen_wifi_SmartConfig_Button, 0, LV_STATE_DEFAULT);
    lv_obj_set_width(ui->screen_wifi_SmartConfig_Button_label, LV_PCT(100));
    lv_obj_set_pos(ui->screen_wifi_SmartConfig_Button, 26, 186);
    lv_obj_set_size(ui->screen_wifi_SmartConfig_Button, 188, 40);

    //Write style for screen_wifi_SmartConfig_Button, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_bg_opa(ui->screen_wifi_SmartConfig_Button, 226, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(ui->screen_wifi_SmartConfig_Button, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_dir(ui->screen_wifi_SmartConfig_Button, LV_GRAD_DIR_HOR, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_color(ui->screen_wifi_SmartConfig_Button, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_main_stop(ui->screen_wifi_SmartConfig_Button, 80, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_stop(ui->screen_wifi_SmartConfig_Button, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_width(ui->screen_wifi_SmartConfig_Button, 1, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_opa(ui->screen_wifi_SmartConfig_Button, 93, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_color(ui->screen_wifi_SmartConfig_Button, lv_color_hex(0x020202), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_side(ui->screen_wifi_SmartConfig_Button, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_radius(ui->screen_wifi_SmartConfig_Button, 10, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_width(ui->screen_wifi_SmartConfig_Button, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(ui->screen_wifi_SmartConfig_Button, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(ui->screen_wifi_SmartConfig_Button, &lv_font_Acme_Regular_17, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_opa(ui->screen_wifi_SmartConfig_Button, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_align(ui->screen_wifi_SmartConfig_Button, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes screen_wifi_WIFI_1
    ui->screen_wifi_WIFI_1 = lv_img_create(ui->screen_wifi);
    lv_obj_add_flag(ui->screen_wifi_WIFI_1, LV_OBJ_FLAG_CLICKABLE);
    lv_img_set_src(ui->screen_wifi_WIFI_1, &_WIFI_1_64x62);
    lv_img_set_pivot(ui->screen_wifi_WIFI_1, 50,50);
    lv_img_set_angle(ui->screen_wifi_WIFI_1, 0);
    lv_obj_set_pos(ui->screen_wifi_WIFI_1, 86, 60);
    lv_obj_set_size(ui->screen_wifi_WIFI_1, 64, 62);

    //Write style for screen_wifi_WIFI_1, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_img_recolor_opa(ui->screen_wifi_WIFI_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_img_opa(ui->screen_wifi_WIFI_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_radius(ui->screen_wifi_WIFI_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_clip_corner(ui->screen_wifi_WIFI_1, true, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes screen_wifi_AP_STA_coexistence
    ui->screen_wifi_AP_STA_coexistence = lv_btn_create(ui->screen_wifi);
    ui->screen_wifi_AP_STA_coexistence_label = lv_label_create(ui->screen_wifi_AP_STA_coexistence);
    lv_label_set_text(ui->screen_wifi_AP_STA_coexistence_label, "AP-STA Coexistence Mode");
    lv_label_set_long_mode(ui->screen_wifi_AP_STA_coexistence_label, LV_LABEL_LONG_WRAP);
    lv_obj_align(ui->screen_wifi_AP_STA_coexistence_label, LV_ALIGN_CENTER, 0, 0);
    lv_obj_set_style_pad_all(ui->screen_wifi_AP_STA_coexistence, 0, LV_STATE_DEFAULT);
    lv_obj_set_width(ui->screen_wifi_AP_STA_coexistence_label, LV_PCT(100));
    lv_obj_set_pos(ui->screen_wifi_AP_STA_coexistence, 26, 233);
    lv_obj_set_size(ui->screen_wifi_AP_STA_coexistence, 188, 40);

    //Write style for screen_wifi_AP_STA_coexistence, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_bg_opa(ui->screen_wifi_AP_STA_coexistence, 226, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(ui->screen_wifi_AP_STA_coexistence, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_dir(ui->screen_wifi_AP_STA_coexistence, LV_GRAD_DIR_HOR, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_color(ui->screen_wifi_AP_STA_coexistence, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_main_stop(ui->screen_wifi_AP_STA_coexistence, 80, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_stop(ui->screen_wifi_AP_STA_coexistence, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_width(ui->screen_wifi_AP_STA_coexistence, 1, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_opa(ui->screen_wifi_AP_STA_coexistence, 93, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_color(ui->screen_wifi_AP_STA_coexistence, lv_color_hex(0x020202), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_side(ui->screen_wifi_AP_STA_coexistence, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_radius(ui->screen_wifi_AP_STA_coexistence, 10, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_width(ui->screen_wifi_AP_STA_coexistence, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(ui->screen_wifi_AP_STA_coexistence, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(ui->screen_wifi_AP_STA_coexistence, &lv_font_Acme_Regular_17, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_opa(ui->screen_wifi_AP_STA_coexistence, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_align(ui->screen_wifi_AP_STA_coexistence, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);

    //Write codes screen_wifi_STA_reconnection
    ui->screen_wifi_STA_reconnection = lv_btn_create(ui->screen_wifi);
    ui->screen_wifi_STA_reconnection_label = lv_label_create(ui->screen_wifi_STA_reconnection);
    lv_label_set_text(ui->screen_wifi_STA_reconnection_label, "STA Reconnection");
    lv_label_set_long_mode(ui->screen_wifi_STA_reconnection_label, LV_LABEL_LONG_WRAP);
    lv_obj_align(ui->screen_wifi_STA_reconnection_label, LV_ALIGN_CENTER, 0, 0);
    lv_obj_set_style_pad_all(ui->screen_wifi_STA_reconnection, 0, LV_STATE_DEFAULT);
    lv_obj_set_width(ui->screen_wifi_STA_reconnection_label, LV_PCT(100));
    lv_obj_set_pos(ui->screen_wifi_STA_reconnection, 26, 140);
    lv_obj_set_size(ui->screen_wifi_STA_reconnection, 188, 40);

    //Write style for screen_wifi_STA_reconnection, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
    lv_obj_set_style_bg_opa(ui->screen_wifi_STA_reconnection, 226, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_color(ui->screen_wifi_STA_reconnection, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_dir(ui->screen_wifi_STA_reconnection, LV_GRAD_DIR_HOR, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_color(ui->screen_wifi_STA_reconnection, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_main_stop(ui->screen_wifi_STA_reconnection, 80, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_bg_grad_stop(ui->screen_wifi_STA_reconnection, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_width(ui->screen_wifi_STA_reconnection, 1, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_opa(ui->screen_wifi_STA_reconnection, 93, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_color(ui->screen_wifi_STA_reconnection, lv_color_hex(0x020202), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_border_side(ui->screen_wifi_STA_reconnection, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_radius(ui->screen_wifi_STA_reconnection, 10, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_shadow_width(ui->screen_wifi_STA_reconnection, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_color(ui->screen_wifi_STA_reconnection, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_font(ui->screen_wifi_STA_reconnection, &lv_font_Acme_Regular_17, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_opa(ui->screen_wifi_STA_reconnection, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
    lv_obj_set_style_text_align(ui->screen_wifi_STA_reconnection, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);

    //The custom code of screen_wifi.


    //Update current screen layout.
    lv_obj_update_layout(ui->screen_wifi);

    //Init events for screen.
    events_init_screen_wifi(ui);
}
